$(function () {
    // 登录功能
    $('.btn-login').on('click', function () {
        $.ajax({
            url: '/user/login',
            type: 'post',
            data: $('form').serialize(),
            success: function (info) {
                if (info.error) {
                    mui.toast(info.message) 
                }
                if (info.success) {
                    var backUrl = location.search
                    if (backUrl.indexOf('backUrl=') !== -1) {
                        location.href = backUrl.replace('?backUrl=', '')
                    } else {
                        location.href = 'user.html'
                    }
                }
            }
      }) 
    })
})